import request from '@/utils/request'
export function list(params) {
  return request({
    url:'/admin/purchase/list',
    method:'get',
    params:params
  })
}

export function save(data,params) {
  return request({
    url:'/admin/purchase/save',
    method: 'post',
    data:data,
    params: params
  })
}
export function saveAndInStock(data,params) {
  return request({
    url:'/admin/purchase/saveAndInStock',
    method: 'post',
    data:data,
    params: params
  })
}

export function saveAndConfirm(data,params) {
  return request({
    url:'/admin/purchase/saveAndConfirm',
    method: 'post',
    data:data,
    params: params
  })
}

export function find(id) {
  return request({
    url:'/admin/purchase/find/'+id,
    method:'get'
  })
}

export function update(data) {
  return request({
    url: '/admin/purchase/update',
    method: 'post',
    data: data
  })
}
export function updateAndConfirm(data) {
  return request({
    url: '/admin/purchase/updateAndConfirm',
    method: 'post',
    data: data
  })
}
export function updateAndInStock(data) {
  return request({
    url: '/admin/purchase/updateAndInStock',
    method: 'post',
    data: data
  })
}

export function applyRefund(data) {
  return request({
    url: '/admin/purchase/applyRefund',
    method: 'post',
    data: data
  })
}

export function del(ids) {
  return request({
    url:'/admin/purchase/del/'+ids,
    method: 'post',
  })
}


export function confirm(orderId) {
  return request({
    url:'/admin/purchase/confirm/'+orderId,
    method: 'post',
  })
}

export function inStock(orderId, params,data) {
  return request({
    url:'/admin/purchase/inStock/'+orderId,
    method: 'post',
    params: params,
    data: data,

  })
}

export function inStockAndAudit(orderId, params,data) {
  return request({
    url:'/admin/purchase/inStockAndAudit/'+orderId,
    method: 'post',
    params: params,
    data: data,

  })
}


export function exportView(id, params) {
  return request({
    url: '/admin/purchase/export/' + id,
    method: 'get',
    params: params
  })
}

export function print(id, token) {
  return request({
    url: '/admin/purchase/print/' + id + '?token=' + token,
    method: 'get'
  })
}

export function returns(orderId, params,data) {
  return request({
    url:'/admin/purchase/returns/'+orderId,
    method: 'post',
    params: params,
    data: data

  })
}

export function returnsAndAudit(orderId, params,data) {
  return request({
    url:'/admin/purchase/returnsAndAudit/'+orderId,
    method: 'post',
    params: params,
    data: data

  })
}

export function cancel(id) {
  return request({
    url: '/admin/purchase/cancel/' + id,
    method: 'post'
  })
}


export function unconfirm(id) {
  return request({
    url: '/admin/purchase/unconfirm/' + id,
    method: 'post'
  })
}
